class Member:
    def __init__(self, level):
        self.level = level

    @property
    def discount_rate(self):
        rates = {'普通': 0.95, '银卡': 0.9, '金卡': 0.85}
        return rates.get(self.level, 1.0)

class CartItem:
    def __init__(self, name, price, quantity, member=None):
        self.name = name
        self.price = price
        self.quantity = quantity
        self.member = member

    @property
    def discounted_price(self):
        if self.member:
            return self.price * self.member.discount_rate
        return self.price

    def total(self):
        return self.discounted_price * self.quantity

class ShoppingCart:
    def __init__(self):
        self.items = []

    def add_item(self, item):
        self.items.append(item)

    def total_without_discount(self):
        return sum(item.price * item.quantity for item in self.items)

    def apply_discount(self):
        return sum(item.total() for item in self.items)

    def show(self):
        print("购物车明细：")
        for item in self.items:
            discount_info = f"{item.member.level}会员 {item.member.discount_rate*100}%折扣" if item.member else "无折扣"
            print(f"{item.name} 数量：{item.quantity}，单价：{item.price}，{discount_info}，小计：{item.total():.2f}")
        print(f"原价总金额：{self.total_without_discount():.2f}")
        print(f"折扣后总金额：{self.apply_discount():.2f}")

# 测试示例
if __name__ == "__main__":
    # 创建会员
    gold_member = Member("金卡")
    silver_member = Member("银卡")

    # 创建购物车并添加商品
    cart = ShoppingCart()
    cart.add_item(CartItem("苹果", 10.0, 2, gold_member))
    cart.add_item(CartItem("牛奶", 20.0, 1, silver_member))
    cart.add_item(CartItem("面包", 5.0, 3))  # 无会员

    cart.show()